Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

253
Visualizações
React Component is not rendering and returns [object Object]

I have to prepare one static HTML and inside it, I have to render a react Link. But it is not working as expected and returns [object Object]. Here is my code.

 const htmlCode =    `<div class='info-container'>
                          <div class='heading-section'>
                              ${<><Link to = {targetURL}>Click Here</Link></>}
                          </div>
                      <div>`

Output I am getting after rendering:

enter image description here

enter image description here

I have consoled that and getting output on console as shown below :

enter image description here

------------------------------------EDIT------------------------------------

The main goal here is, I want to pass this static HTML (variable htmlCode) to another component and that is not rendering but I get object instead of rendered as shown in console output attached here. Is there any way I can render that and convert it to a kind of static HTML before passing to other component?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

JSX is not HTML, it is a syntactic sugar for HTML. You cannot wrap it around strings. It will transpile to React.createElement which returns a JavaScript object.

const htmlCode = <div class='info-container'>
                     <div class='heading-section'>
                         <Link to = {targetURL}>Click Here</Link>
                      </div>
                  <div>

See more of Rendering JSX elements

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda